<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <span>80310495 蔡维洋</span>
        <el-dropdown trigger="click">
          <span class="el-dropdown-link">
            <i class="el-icon-setting"></i>
          </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item icon="el-icon-plus">1</el-dropdown-item>
              <el-dropdown-item icon="el-icon-circle-plus">2</el-dropdown-item>
              <el-dropdown-item icon="el-icon-circle-plus-outline">3</el-dropdown-item>
              <el-dropdown-item icon="el-icon-check">4</el-dropdown-item>
              <el-dropdown-item icon="el-icon-circle-check">5</el-dropdown-item>
            </el-dropdown-menu>
        </el-dropdown>
      </div>
      <div class="header-right">
        <el-input placeholder="请输入操作码" size="small"/>
        <el-dropdown trigger="click">
          <span class="el-dropdown-link">
            <i class="el-icon-setting"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item icon="el-icon-plus">1</el-dropdown-item>
            <el-dropdown-item icon="el-icon-circle-plus">2</el-dropdown-item>
            <el-dropdown-item icon="el-icon-circle-plus-outline">3</el-dropdown-item>
            <el-dropdown-item icon="el-icon-check">4</el-dropdown-item>
            <el-dropdown-item icon="el-icon-circle-check">5</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header>
    <el-container>
      <!-- 侧边栏区域 -->
      <el-aside :width="isCollapse? '64px' : '200px'">
        <div class="toggle-button" @click="toggleCollapse">|||</div>
        <el-menu background-color="#545C64"
                 text-color="#fff"
                 active-text-color="#ffd04b"
                 :default-openeds="['1']"
                 class="el-menu-demo"
                 unique-opened :collapse="isCollapse"
                 :collapse-transition="false"
                 router
        >
          <!-- 一级菜单 -->
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>支付机构控制</span>
            </template>
            <el-menu-item-group title="查询/经办">
              <el-menu-item :index="'/handle'">
                <i class="el-icon-setting"></i>
                <span>支付机构配置</span>
              </el-menu-item>
              <el-menu-item index="1-2">
                <i class="el-icon-setting"></i>
                <span>二级商户配置</span>
              </el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group title="复核">
              <el-menu-item index="1-3">
                <i class="el-icon-search"></i>
                <span>复核</span>
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!-- 内容区域 -->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      isCollapse: false
    }
  },
  methods: {
    toggleCollapse() {
      this.isCollapse = !this.isCollapse
    }
  },
  async mounted() {
    // 请求写法
    try {
      const res = await this.$http.post('login', {name: 1})
      console.log(res)
    }catch (err){
      console.log(123)
    }
  }
}
</script>

<style lang="less" scoped>
.home-container {
  height: 100%;
}

.el-header {
  background-color: #373d41;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #dddddd;

  .header-right {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .el-icon-setting {
    margin-left: 10px;
  }
}

.el-aside {
  background-color: #333744;
  .el-menu {
    border-right: none;
  }
  .toggle-button {
    background-color: #4A5064;
    font-size: 10px;
    line-height: 24px;
    color: #fff;
    text-align: center;
    letter-spacing: 0.2em;
    cursor: pointer;
  }
}

.el-main {
  background-color: #EAEDF1;
}

.el-dropdown-link {
  cursor: pointer;
  color: #ffffff;
}
</style>